package com.huicun.pay;

import com.huicun.pay.wxpay.WxPayConfig;
import com.huicun.pay.wxpay.WxPayService;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @Time: 2021/4/12 19:25
 * @Author: lidiwei
 */

@Configuration
@EnableConfigurationProperties(WxPayConfig.class)
public class PayAutoConfiguration implements DisposableBean {
    private WxPayService wxPayService;
    @Resource
    private WxPayConfig wxPayConfig;

    @Bean
    public WxPayService initBean() {
        wxPayService = new WxPayService(wxPayConfig);

        return wxPayService;
    }

    @Override
    public void destroy() throws Exception {
    }
}
